import { getRouterParam } from 'h3'
import { getAppsData } from '~/server/plugins/apps'

export default defineEventHandler(async (event) => {
    try {
        const slug = getRouterParam(event, 'slug')
        // 使用预加载的数据
        const allApps = getAppsData()
        // 根据slug查找应用
        const app = allApps.find(app => app.slug === slug)
        
        return app
    } catch (error) {
        console.error('Error finding app:', error)
        return null
    }
}) 